''' Mission 9 Remix 1B Includes a random beep for each arrow spin Uses half the delay for beep and half for waiting Use button D to end game ''' from codex import * import random from time import sleep def show_random_arrow(): arrow = random.randrange(8) display.show(pics.ALL_ARROWS[arrow]) def spin_animation(count): index = 0 loops = 0 delay = 0.0 tone = random.randrange(400, 700) while loops < count: loops = loops + 1 display.show(pics.ALL_ARROWS[index]) audio.pitch(tone, delay/2) sleep(delay/2) delay = delay + 0.005 index = index + 1 if index == 8: index = 0 # Main Program while True: if buttons.is_pressed(BTN_A) or buttons.is_pressed(BTN_B): spin_animation(20) show_random_arrow() if buttons.is_pressed(BTN_D): break display.clear() display.print("Thanks",scale=4)